﻿using RabbitMQClient;
using System;

namespace RpcServerConsole1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("RPC server wait request");
            RabbitMQClient.IRabbitMQClient client = new RabbitMQClient.RabbitMQClient(
                host: "localhost",
                port: 5672,
                userName: "root",
                passowrd: "123456"
            );

            client.RegisterRpcHandle<RequestModel, ResponseModel>("rpc_queue", x =>
            {
                System.Threading.Thread.Sleep(2000);
                Console.WriteLine(" [.] receive '{0}'", x.a);
                return new ResponseModel() { a = x.a + 1 };
            });

            Console.WriteLine(" Press [enter] to exit.");
            Console.ReadLine();
        }
    }
}
